home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / comm / mail / U_JoinThor14.lha / U-Join.thor < prev   
Text File  |  1996-09-15  |  3KB  |  166 lines

  1. /* $VER: U-Join v1.4 by Vincent O'Malley (13/9/96) */
  2.  
  3. /* Edit these 3 lines for your system setup */
  4.  
  5. UData = 'BBS0/PassConf.data' /* Main directory for PassConf.data */
  6. Tempfile = 'Ram:T/Utemp' /* desination for temp file */
  7. EnJoin = Y /* N to disable Search/Join requester */
  8.  
  9. /* Do not edit anything below this unless you know what your doing */
  10.  
  11. /* check FOR rexxsupport.library */
  12.  
  13. IF ~ Show('l','rexxsupport.library') THEN
  14.     DO
  15.      CALL  AddLib('rexxsupport.library',0,-30,0)
  16.        END
  17.  
  18. OPTIONS RESULTS
  19.  
  20. /* Get THOR path */
  21.  
  22.     ADDRESS(REXX)
  23.  
  24.         Open(path,'env:thor/thorpath','r')
  25.            THORpath = ReadLn(path)
  26.            CALL Close('env:thor/thorpath')
  27.  
  28.         Open(thordat,'env:thor/BBSDataPath','r')
  29.            DATApath = ReadLn(thordat)
  30.            CALL Close('env:thor/BBSDataPath')
  31.  
  32. /* Check TO see IF BBSREAD lib is loaded */
  33.  
  34.           IF ~ Show('p','BBSREAD') THEN
  35.               DO
  36.                 ADDRESS command "run >nil: "THORpath"bin/LoadBBSRead"
  37.                 "Waitforport BBSREAD"
  38.             END
  39.  
  40. /* Get Current system */
  41.  
  42.     ADDRESS(Thor.01)
  43.  
  44.        CURRENTSYSTEM stem CURRENT
  45.  
  46.           IF rc ~ = 0 THEN
  47.               DO
  48.                 SAY THOR.LASTERROR
  49.            EXIT
  50.          END
  51.  
  52. BBS = CURRENT.BBSNAME
  53.  
  54. /* Search or Join requester */
  55.  
  56. IF EnJoin = Y THEN
  57.     DO
  58.        REQUESTNOTIFY '"Do you want to Search or Join"' BT '"_Search|_Cancel|_Join"'
  59.  
  60.           IF RESULT = 1 THEN CALL Search
  61.           IF RESULT = 0 THEN CALL Join
  62.           IF RESULT = 2 THEN EXIT
  63.   END
  64.  
  65. Search:
  66.  
  67. /* Get search string */
  68.  
  69.     ADDRESS(Thor.01)
  70.  
  71.        REQUESTSTRING TITLE '"Search String"' BT '"OK|Cancel"'
  72.           IF rc=5 THEN
  73.               DO
  74.                 EXIT
  75.             END
  76.  
  77. string = RESULT
  78.  
  79. /* Search PassConf.data */
  80.  
  81.     ADDRESS(REXX)
  82.  
  83.       ADDRESS command
  84.       'search NONUM' DATApath||UData string' >'Tempfile
  85.  
  86. /* Read result of search */
  87.  
  88. i = 0
  89.      CALL Open(Utext,Tempfile,'r')
  90.               DO WHILE ~Eof(Utext)
  91.                 i=i+1
  92.                 FOUND.i = ReadLn(Utext)
  93.             END
  94.  
  95. CALL Close(Utext)
  96. CALL Delete(Tempfile)
  97. i = i - 1
  98.  
  99. /* Check to see if any groups where found */
  100.  
  101.     ADDRESS(Thor.01)
  102.  
  103.           FOUND.COUNT = i
  104.           TEST = Words(FOUND.1)
  105.  
  106.           IF test = 0 THEN
  107.               DO
  108.                 REQUESTNOTIFY TEXT '"No Groups FOUND"' BT '"_Ok"'
  109.             EXIT
  110.           END
  111.  
  112. /* Selection List */
  113.  
  114.        REQUESTLIST INSTEM FOUND OUTSTEM SAVE MULTISELECT TITLE '"Listed Groups"'
  115.  
  116.           IF (RC > 0) THEN
  117.               DO
  118.                 REQUESTNOTIFY TEXT '"No Groups Selected"' BT '"_Ok"'
  119.             EXIT
  120.           END
  121.  
  122. /* Write UserNet Events */
  123.  
  124.     ADDRESS(BBSREAD)
  125.  
  126.           DO i=1 TO SAVE.COUNT
  127.           EVE_JOINCONF=2
  128.           DROP GROUP.
  129.           GROUP.CONFERENCE=SAVE.i
  130.  
  131.        WRITEBREVENT BBSNAME BBS EVENT EVE_JOINCONF STEM GROUP
  132.  
  133.           IF rc ~=0 THEN
  134.               DO
  135.                 SAY BBSREAD.LASTERROR
  136.             EXIT
  137.           END
  138.         END
  139.      EXIT
  140.  
  141. Join:
  142.  
  143.        REQUESTSTRING TITLE '"Joining Confrence"' BT '"OK|Cancel"'
  144.  
  145.           IF rc=5 THEN
  146.               DO
  147.                 EXIT
  148.             END
  149.  
  150.     ADDRESS(BBSREAD)
  151.  
  152.           EVE_JOINCONF=2
  153.           DROP CON.
  154.           CON.CONFERENCE = RESULT
  155.  
  156.        WRITEBREVENT BBSNAME BBS EVENT EVE_JOINCONF STEM CON
  157.  
  158.           IF rc ~=0 THEN
  159.               DO
  160.                 SAY BBSREAD.LASTERROR
  161.            EXIT
  162.          END
  163. EXIT
  164.  
  165.  
  166.